package com.easytake.emotioncat.controller;

import com.easytake.emotioncat.dto.PageResult;
import com.easytake.emotioncat.dto.Response;
import com.easytake.emotioncat.entity.EmDictionaryEntity;
import com.easytake.emotioncat.entity.EmListEntity;
import com.easytake.emotioncat.service.IEmDictionaryService;
import com.easytake.emotioncat.service.IEmUserInfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 字典表 前端控制器
 * </p>
 *
 * @author baomidou
 * @since 2022-10-27
 */
@Tag(name = "词典接口")
@RestController
@RequestMapping("/dictionary")
public class EmDictionaryController {

    @Autowired
    IEmDictionaryService dictionaryService;

    @Operation(summary = "查询词典")
    @GetMapping
    @Parameter(name = "type", description = "词典类型, 0.全部 1. 情绪类型 2. 情绪影响")
    public Response<List<EmDictionaryEntity>> getList(@RequestParam(required = false, defaultValue = "0") Integer type) {
        List<EmDictionaryEntity> entityList = dictionaryService.getListByType(type);
        return Response.success(entityList);
    }

}
